package com.demo.strategy.hm;

/**
 * @author lkz
 * @ClassName: Strategy
 * @description: TODO
 * @date 2022/3/17 18:59
 */
public interface Strategy {
    void show();

}

class StrategyA implements Strategy{
    @Override
    public void show() {
        System.out.println("春节");
    }
}

class StrategyB implements Strategy{
    @Override
    public void show() {
        System.out.println("中秋");
    }
}

class SalesMan {
    //持有抽象策略角色的引用
    private Strategy strategy;

    public SalesMan(Strategy strategy) {
        this.strategy = strategy;
    }

    //向客户展示促销活动
    public void salesManShow(){
        strategy.show();
    }
}

class StrategyClient{

    public static void main(String[] args) {
        Strategy strategy=   new StrategyA();
        SalesMan salesMan=new SalesMan(strategy);
        salesMan.salesManShow();

    }

}
